package com.prig.base.repository;

import com.prig.base.entity.Admin;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

@Repository
public interface AdminRepository extends JpaRepository<Admin,Long>, JpaSpecificationExecutor {

    Admin findByAccountAndPassword(String account,String password);

    Admin findByAccount(String account);
    @Transactional
    @Query(nativeQuery = true,value = "delete from admin where id in :adminIds")
    @Modifying
    void deleteByIds(List<Long> adminIds);
}
